package com.qianfeng.yime;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import com.qianfeng.yime.util.CommonUtils;

/**
 * Created by Fcy on 2015/3/11.
 */
public class SettingActivity extends BaseActivity implements View.OnClickListener {

    private Dialog dialog;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);

        findViewById(R.id.setting_about).setOnClickListener(this);
        findViewById(R.id.setting_feedback).setOnClickListener(this);
        findViewById(R.id.setting_update).setOnClickListener(this);
        findViewById(R.id.setting_exit).setOnClickListener(this);

        dialog = CommonUtils.getProgressDialog(this, "正在检查更新...");
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.setting_about:
                // TODO 查看本地WebView

                break;
            case R.id.setting_feedback: // 反馈
                break;
            case R.id.setting_update:
                // TODO 检查更新
                // 模拟，假的
                dialog.show();
                new Handler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        // TODO Auto-generated method stub
                        dialog.dismiss();
                        CommonUtils.toast(SettingActivity.this, "当前版本是最新版本");
                    }
                }, 1000);

                break;
            case R.id.mine_card_exit:
                // TODO 退出应用
                break;
        }
    }
}